//
//  HTHomeCell.swift
//  mySinaBlog
//
//  Created by whtapple on 3/27/16.
//  Copyright © 2016 whtapple. All rights reserved.
//

import UIKit

class HTHomeCell: UITableViewCell {
    //状态数据
    var status:HTStatus?{
        didSet{
            //cell有值后直接传给originnalView
            originnalView.status = status

        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
       
    }
    ///重写 init方法
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
       backgroundColor = UIColor(white: 237 / 255.0, alpha: 1.0)
        prepareUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
//准备控件和数据
    func prepareUI(){
        //添加控件
        contentView.addSubview(originnalView)
        contentView.addSubview(bottomView)
       
        //约束
        originnalView.snp_makeConstraints { (make) -> Void in
            make.leading.trailing.equalTo(contentView)
            make.top.equalTo(contentView).offset(10)
        }
      
        bottomView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(originnalView.snp_bottom)
            make.leading.trailing.equalTo(contentView)
            make.height.equalTo(44)
        }
        
        contentView.snp_makeConstraints { (make) -> Void in
            make.top.leading.trailing.equalTo(self)
            make.bottom.equalTo(bottomView)
        }

    }
    //MARK: -懒加载子控件
    private lazy var originnalView: HTStatusOriginalView = HTStatusOriginalView()
    private lazy var bottomView: HTbottomView = HTbottomView()
   
}
